import React, { Component } from 'react'
import BottomNav from '../components/BottomNav'
import { Redirect } from 'react-router-dom'
export default class home extends Component {
    constructor(props) {
        super(props)
        this.state = {
            bottomNav: [
                {
                    name: '首页',
                    path: "/home/homePage",
                    query: {}
                },
                {
                    name: '新房',
                    path: "/home/newhouse",
                    query: { name: 'user' }// 参数
                },
                {
                    name: '发布',
                    path: "/home/Yrelease",
                },
                {
                    name: '二手',
                    path: "/home/resoldhouse",
                },
                {
                    name: '出租',
                    path: "/home/lease",
                    query: {}
                },
                {
                    name: '我的',
                    path:  "/home/my"
                },
            ],
        }
    }
    render() {
        return (
            <>
                {this.props.location.pathname === '/home' ? <Redirect to="/home/homePage"></Redirect>:null}
                {this.props.children}
                <BottomNav history={this.props.history} value={this.state.bottomNav} defaultIndex={1}></BottomNav>
            </>
        )
    }
}
